//
//  UINavigationController+Extension.swift
//  mall-ios
//
//  Created by Meak Tsui on 2018/12/18.
//  Copyright © 2018 Meak Tsui. All rights reserved.
//

import Foundation
import UIKit

extension UINavigationController {
    public func redirectTo(_ controller:UIViewController,animated:Bool) {
        pushViewController(controller, animated: animated)
        if viewControllers.count <= 2 {
            dPrint("navigation viewControlers count is less than 2")
            return
        }
        viewControllers.remove(at: viewControllers.count - 2)
    }
}
